<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        :root {
            --bgc: red;
            --cr: #0099ff;
        }

        .box {
            color: var(--cr);
        }

        .box3 {
            background-color: var(--bgc);
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="box1">
            111
            <div class="box2">222
                <div class="box3">
                    33333
                </div>
            </div>
        </div>
    </div>
</body>

</html>